<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<div class="box1" style="background-color:rgba(208,10,238,0.65);">
    文本
    <button id="btn">点击</button>
    <a href="https://www.baidu.com">百度一下</a>
</div>

<script>
    let box1 = document.querySelector('.box1');
    let btn = document.getElementById('btn');
    let aEle = document.querySelector('a');

    aEle.addEventListener('click', function (e) {
        e.preventDefault();
        e.stopPropagation();
        console.log(this.innerText)
        console.log(this.href)

    })


    box1.addEventListener('click', function (e) {
        console.log('box1盒子被点击了');

    });
    btn.addEventListener('click', function (e) {
        console.log('btn按钮被点击了');
        e.stopPropagation();
    });
</script>
</body>
</html>
